// MaterialPropertiesDlg.cpp : implementation file
// Author:	Dani Brunstein, 3/11/2001
//			Computer Graphics
// Send bugs to: danikoz@cs.technion.ac.il
//

#include "stdafx.h"
#include "CGWork.h"
#include "MaterialPropertiesDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMaterialPropertiesDlg dialog


CMaterialPropertiesDlg::CMaterialPropertiesDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CMaterialPropertiesDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMaterialPropertiesDlg)
	m_strAmbient = _T("");
	m_strDiffuse = _T("");
	m_strSpecular = _T("");
	m_nMaterialCosineFactor = 0;
	//}}AFX_DATA_INIT
}


void CMaterialPropertiesDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMaterialPropertiesDlg)
	DDX_Control(pDX, IDC_SPECULAR, m_controlSpecular);
	DDX_Control(pDX, IDC_DIFFUSE, m_controlDiffuse);
	DDX_Control(pDX, IDC_AMBIENT, m_controlAmbient);
	DDX_LBString(pDX, IDC_AMBIENT, m_strAmbient);
	DDX_LBString(pDX, IDC_DIFFUSE, m_strDiffuse);
	DDX_LBString(pDX, IDC_SPECULAR, m_strSpecular);
	DDX_Text(pDX, IDC_COSINE, m_nMaterialCosineFactor);
	DDV_MinMaxInt(pDX, m_nMaterialCosineFactor, 0, 127);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMaterialPropertiesDlg, CDialog)
	//{{AFX_MSG_MAP(CMaterialPropertiesDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMaterialPropertiesDlg message handlers

BOOL CMaterialPropertiesDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();	// call father function. This is for DDX to work.
	
	// in each List box, set 100 values, ranges from 0 to 1.
	CString str;
	for (double d = 0; d<=1.001; d+=.01) {
		str.Format("%.2lf", d);
		m_controlAmbient.AddString(str);
		m_controlDiffuse.AddString(str);
		m_controlSpecular.AddString(str);
	}
	// select the current values
	m_controlAmbient.SelectString(-1, m_strAmbient);
	m_controlDiffuse.SelectString(-1, m_strDiffuse);
	m_controlSpecular.SelectString(-1, m_strSpecular);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
